Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rtnetlink version Upgrade #30

Merged
merged 2 commits into from
Sep 17, 2024
Merged

Rtnetlink version Upgrade #30

merged 2 commits into from
Sep 17, 2024

Conversation

Paul-weqe
Copy link
Member

  • upgrade rtnetlink to latest version: 0.4.1. Still unstable
  • upgrade netlink-packet-route to version 0.19.
  • Introduce netlink-packet-utils. Some of the items we were previously using in netlink-packet-route are now only accessible via that library.

Majority of the changes have been made in
the netlink.rs files that exist both in
holo-routing and holo-interface.

There have been several changes on rtnetlink &
netlink-packet-route and key files, functions and
structs have also been moved in the library.
The changes have been reflected in this commit.

The upgrade has been necessitated due to the need for
the ability to edit mac addresses while creating an interface
(on the vrrp branch)

- upgrade rtnetlink to latest version: 0.4.1.
    Still unstable
- upgrade netlink-packet-route to version 0.19.
- Introduce netlink-packet-utils. Some of the
    items we were previously using in
    netlink-packet-route are now only accessible
    via that library.

Majority of the changes have been made in
the `netlink.rs` files that exist both in
`holo-routing` and `holo-interface`.

There have been several changes on rtnetlink &
netlink-packet-route and key files, functions and
structs have also been moved in the library.
The changes have been reflected in this commit.

Signed-off-by: Paul Wekesa <[email protected]>
Copy link

github-actions bot commented Sep 14, 2024

Test Results

    1 files  ±0    15 suites  ±0   0s ⏱️ ±0s
376 tests ±0  374 ✔️ ±0  2 💤 ±0  0 ±0 
380 runs  ±0  378 ✔️ ±0  2 💤 ±0  0 ±0 

Results for commit 0b2dd02. ± Comparison against base commit 754a2a3.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Sep 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.42%. Comparing base (754a2a3) to head (0b2dd02).
Report is 1 commits behind head on vrrp.

Additional details and impacted files
@@            Coverage Diff             @@
##             vrrp      #30      +/-   ##
==========================================
- Coverage   63.50%   63.42%   -0.09%     
==========================================
  Files         177      177              
  Lines       29643    29660      +17     
==========================================
- Hits        18825    18812      -13     
- Misses      10818    10848      +30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@rwestphal rwestphal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Paul-weqe Thanks for this! Looks great overall, just have a couple of minor comments.

use netlink_sys::{AsyncSocket, SocketAddr};
use rtnetlink::{new_connection, Handle};
use tracing::{error, trace};

use crate::interface::Owner;
use crate::Master;

const AF_INET: u16 = libc::AF_INET as u16;
const AF_INET6: u16 = libc::AF_INET6 as u16;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It might be cleaner to import the constants (use libc::{AF_INET, AF_INET6};) rather than redefining them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwestphal libc::AF_INET is of type i32. I did this for to be type u16 so that we can use it inside the parse_address method.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

for flg in &msg.header.flags {
flgs += u32::from(*flg);
}
if flgs & u32::from(LinkFlag::Running) != 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we use msg.header.flags.contains(LinkFlag::Running) instead?

https://docs.rs/netlink-packet-route/latest/netlink_packet_route/link/struct.LinkFlags.html#method.contains

remove the AF_INET const definitions on top of `holo-interface`'s
netlink.rs.
change procedure of looking for flags to `msg.header.flags.contains`

Signed-off-by: Paul Wekesa <[email protected]>
@Paul-weqe
Copy link
Member Author

@rwestphal your help is requested.

Linter is failing despite the line it says is failing does not exist on the branch (upgrade-rtnetlink). The line exists in vrrp branch where the change has also been made but it still fails.

Can we treat that as a false negative ?

Copy link
Member

@rwestphal rwestphal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwestphal your help is requested.

Linter is failing despite the line it says is failing does not exist on the branch (upgrade-rtnetlink). The line exists in vrrp branch where the change has also been made but it still fails.

Can we treat that as a false negative ?

Yeah that lint error doesn't make sense.

Thanks for the updates! I'll go ahead and merge this.

Would you mind opening the same PR against master as well? The more we can move to master, the less likely we'll run into conflicts when merging the vrrp branch later.

@rwestphal rwestphal merged commit 1b849c9 into vrrp Sep 17, 2024
9 of 10 checks passed
@Paul-weqe
Copy link
Member Author

@rwestphal opening in a few.

@Paul-weqe Paul-weqe deleted the upgrade-rtnetlink branch September 17, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants